using System.ComponentModel.DataAnnotations;

namespace MediPlatform.Read.Api.Models
{
    /// <summary>
    /// 药品订单查询请求模型
    /// </summary>
    public class MedicalOrderQueryRequest
    {
        /// <summary>
        /// 订单号或用户名
        /// </summary>
        public string? OrderNoOrUsername { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// 订单状态：0-待发货, 1-待收货, 2-已收货, 6-已取消, null-全部
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        [Range(1, int.MaxValue)]
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页大小
        /// </summary>
        [Range(1, 100)]
        public int PageSize { get; set; } = 10;
    }

    /// <summary>
    /// 药品订单列表项响应模型
    /// </summary>
    public class MedicalOrderListItem
    {
        /// <summary>
        /// 订单ID
        /// </summary>
        public long? Id { get; set; }

        /// <summary>
        /// 订单编号
        /// </summary>
        public string? OrderNo { get; set; }

        /// <summary>
        /// 提交时间
        /// </summary>
        public DateTime? CreatedAt { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string? Username { get; set; }

        /// <summary>
        /// 收货人
        /// </summary>
        public string? Recipient { get; set; }

        /// <summary>
        /// 订单金额
        /// </summary>
        public decimal? TotalAmount { get; set; }

        /// <summary>
        /// 订单状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 订单状态文本
        /// </summary>
        public string? StatusText { get; set; }

        /// <summary>
        /// 物流公司
        /// </summary>
        public string? LogisticsCompany { get; set; }

        /// <summary>
        /// 物流单号
        /// </summary>
        public string? TrackingNumber { get; set; }
    }

    /// <summary>
    /// 药品订单分页响应模型
    /// </summary>
    public class MedicalOrderPagedResponse
    {
        /// <summary>
        /// 数据列表
        /// </summary>
        public List<MedicalOrderListItem> Items { get; set; } = new();

        /// <summary>
        /// 总记录数
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 总页数
        /// </summary>
        public int TotalPages { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        public int CurrentPage { get; set; }

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; }
    }

    /// <summary>
    /// 药品订单详情响应模型
    /// </summary>
    public class MedicalOrderDetailResponse
    {
        /// <summary>
        /// 订单基本信息
        /// </summary>
        public MedicalOrderInfo OrderInfo { get; set; } = new();

        /// <summary>
        /// 订单商品列表
        /// </summary>
        public List<MedicalOrderItemInfo> OrderItems { get; set; } = new();

        /// <summary>
        /// 物流追踪信息
        /// </summary>
        public List<LogisticsTrackingInfo> LogisticsTracking { get; set; } = new();
    }

    /// <summary>
    /// 订单基本信息
    /// </summary>
    public class MedicalOrderInfo
    {
        /// <summary>
        /// 订单ID
        /// </summary>
        public long? Id { get; set; }

        /// <summary>
        /// 订单编号
        /// </summary>
        public string? OrderNo { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        public long? UserId { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string? Username { get; set; }

        /// <summary>
        /// 订单总金额
        /// </summary>
        public decimal? TotalAmount { get; set; }

        /// <summary>
        /// 实际支付金额
        /// </summary>
        public decimal? ActualAmount { get; set; }

        /// <summary>
        /// 订单状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 订单状态文本
        /// </summary>
        public string? StatusText { get; set; }

        /// <summary>
        /// 支付方式
        /// </summary>
        public string? PaymentMethod { get; set; }

        /// <summary>
        /// 支付时间
        /// </summary>
        public DateTime? PaymentTime { get; set; }

        /// <summary>
        /// 配送地址
        /// </summary>
        public string? DeliveryAddress { get; set; }

        /// <summary>
        /// 物流公司
        /// </summary>
        public string? LogisticsCompany { get; set; }

        /// <summary>
        /// 物流单号
        /// </summary>
        public string? TrackingNumber { get; set; }

        /// <summary>
        /// 签收时间
        /// </summary>
        public DateTime? SignTime { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatedAt { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdatedAt { get; set; }
    }

    /// <summary>
    /// 订单商品信息
    /// </summary>
    public class MedicalOrderItemInfo
    {
        /// <summary>
        /// 商品ID
        /// </summary>
        public long? Id { get; set; }

        /// <summary>
        /// 药品ID
        /// </summary>
        public long? MedicineId { get; set; }

        /// <summary>
        /// 药品名称
        /// </summary>
        public string? MedicineName { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        public string? Specification { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public decimal? UnitPrice { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public int? Quantity { get; set; }

        /// <summary>
        /// 小计金额
        /// </summary>
        public decimal? Subtotal { get; set; }
    }

    /// <summary>
    /// 物流追踪信息
    /// </summary>
    public class LogisticsTrackingInfo
    {
        /// <summary>
        /// 追踪ID
        /// </summary>
        public long? Id { get; set; }

        /// <summary>
        /// 物流单号
        /// </summary>
        public string? TrackingNumber { get; set; }

        /// <summary>
        /// 物流公司
        /// </summary>
        public string? LogisticsCompany { get; set; }

        /// <summary>
        /// 当前位置
        /// </summary>
        public string? Location { get; set; }

        /// <summary>
        /// 物流状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 物流状态文本
        /// </summary>
        public string? StatusText { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 扩展信息
        /// </summary>
        public string? ExtraInfo { get; set; }
    }

    /// <summary>
    /// 订单状态统计响应模型
    /// </summary>
    public class MedicalOrderStatisticsResponse
    {
        /// <summary>
        /// 总订单数
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 待发货订单数
        /// </summary>
        public int PendingShipmentCount { get; set; }

        /// <summary>
        /// 待收货订单数
        /// </summary>
        public int PendingReceiptCount { get; set; }

        /// <summary>
        /// 已收货订单数
        /// </summary>
        public int ReceivedCount { get; set; }

        /// <summary>
        /// 已取消订单数
        /// </summary>
        public int CancelledCount { get; set; }
    }
} 